<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="./vue2.js"></script>
<style>
    *{
        margin: 0;
        padding: 0;
    }
    ul{position: fixed;
        bottom: 0;
        display: flex;
        list-style: none;
        width: 100%;
        height: 50px;
    }
    li{
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: aquamarine;
        color: black;
        flex: 1;
        font-size: 20px;
    }
</style>
<body>
    <div id="box">
        <!-- <product v-show="which==='product'"></product>
        <list v-show="which==='list'"></list>
        <shopcar v-show="which==='shopcar'"></shopcar> -->
        <keep-alive>
            <component :is="which"></component>
        </keep-alive>

        <div>
            <ul>
                <li @click="which='product'">商品</li>
                <li @click="which='list'">列表</li>
                <li @click="which='shopcar'">购物车</li>
            </ul>
        </div>
    </div>
    <script>
        Vue.component('product',{
            template:`<div>product<input /></div>`
        })
        Vue.component('list',{
            template:`<div>list</div>`
        })
        Vue.component('shopcar',{
            template:`<div>shopcar</div>`
        })
       let vm= new Vue({
            el:'#box',
            data:{
                which:'product'
            },
            methods:{

            }
        })
    </script>
</body>
</html>